for %y vw5 vw
for %z ivol10 beta ik tq pe 
read(t=xls, s=single{%z}{%y}, c2) 2021.xls 10

for !i=1 to 10
genr {%z}{!i}=port{!i}
delete port{!i}
next

for !i=3 to 8
delete {%z}{!i}
next

group input{%y}

for !i=1 to 2
equation eq{!i}.ls(n) {%z}{!i}-rf c mkt
eq{!i}.fit {%z}{!i}f
genr res{%z}{!i}={%z}{!i}-{%z}{!i}f+eq{!i}.@coefs(1)
input{%y}.add res{%z}{!i}
delete eq{!i} {%z}{!i}f
next

for !i=9 to 10
equation eq{!i}.ls(n) {%z}{!i}-rf c mkt
eq{!i}.fit {%z}{!i}f
genr res{%z}{!i}={%z}{!i}-{%z}{!i}f+eq{!i}.@coefs(1)
input{%y}.add res{%z}{!i}
delete eq{!i} {%z}{!i}f
next

next
input{%y}.makepcomp pc1{%y} pc2{%y}
delete input{%y}
next

for %z ivol10 beta ik tq pe 
for %y vw5

for !i=1 to 2
delete {%z}{!i} res{%z}{!i}
next

for !i=9 to 10
delete {%z}{!i} res{%z}{!i}
next

next
next
